Skip to content

Conversation

@766974616c79
Copy link
Contributor

Using the above code, the builder returns a URL that is not supported by the HTTP client. You must use the Authorisation header to be able to use authentication.

Resolves Facepunch/sbox-issues#5798

@garrynewman garrynewman requested a review from Copilot December 22, 2025 07:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for HTTP Basic Authentication by extracting credentials from the URI's UserInfo component and converting them into a proper Authorization header, resolving an issue where the builder returns URLs not supported by the HTTP client.

Key Changes:

  • Extracts username and password from URI's UserInfo property
  • Converts credentials to Base64-encoded Authorization header
  • Strips credentials from the URI before creating the HTTP request

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@766974616c79 766974616c79 force-pushed the RequestAsync-support-basic-auth branch 2 times, most recently from 5cfde5c to 64ca180 Compare January 11, 2026 15:43
@766974616c79
Copy link
Contributor Author

@garrynewman i made the recommended changes, sorry for the time taken

@766974616c79 766974616c79 force-pushed the RequestAsync-support-basic-auth branch from 64ca180 to 79379eb Compare January 11, 2026 15:48
@handsomematt
Copy link
Member

Send the header manually if you want to use basic auth, the same way you would with a normal .NET HttpClient

@766974616c79 766974616c79 deleted the RequestAsync-support-basic-auth branch January 15, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Http.RequestAsync() doesn't support basic auth in URI

2 participants